<!--Generate by Kevin's CodeBuilder -->
<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
		<meta charset="UTF-8">
		<title>bui-ssm快速开发框架</title>
		<head th:include="source::header"></head>
</head>
<body>
		<div class="form_main_wrap">
			<div class="form_condition">			
			</div>
			<div class="form_grid">
				<table id="datagrid"></table>
			</div>
		</div>
</div>
<script type="application/javascript" th:inline="javascript">
		var curdObj,
			$win,
			height = 292,
			gridOpts = [(${dataGridJson})];//获取datagrid配置json,此处从服务器得到，也可以静态编码			
			var title = "[(${Lang.dict_windowTitle})]";//国际化语言
			gridOpts.title = title;
		$(function () {
			var dg = $("#datagrid");			 //获取table对象
			curdObj = new $B.CURD(dg, gridOpts); //创建curd对象，即创建了datagrid列表
		});
		
		function openEditor (id){
			var opts = {
				dataType:'iframe',
				title:'富文本',
				full:true,
				url:$B.getHttpHost(ctxPath) + "dict/page/editor?id="+id,
			};
			$win = $B.window(opts);
		}
		
		
		/****打开form.html
		*prs:     按钮参数，
		*isUpdate：是否是更新
		*rowData: 行数据对象
		****/
		function _openForm(prs,isUpdate,rowData){
			var opts = {
				dataType:'html',
				title:title,
				width:700,
				height:height
			};
			if(isUpdate && rowData){
				opts.rowData = rowData;
			}
			console.log("open window>>>>>>>>>>>>>>>>>>>");
			curdObj.window(opts,isUpdate);
		};
		/******工具栏事件集合,对应列表工具栏json里面配置的事件名称******/
		window.toolMethods = {
			addFn:function(prs){
				_openForm(prs);                //打开新增窗口
			},
			updateFn:function(prs){
				_openForm(prs,true);            //打开更新窗口
			},
			deleteFn:function(prs){
				curdObj.delChecked();           //删除datagrid里复选的数据
			},
			lineUpdateFn:function(prs){
				_openForm(prs,true,prs);        //行内更新按钮，打开更新窗口
			},
			lineDeleteFn:function(prs){
				curdObj.deleteData([prs.id]);   //行删除    
			},
			editorFn:function(prs){
				var ids = curdObj.getCheckedId();
				if(ids.length > 0){
					openEditor(ids[0]);
				}else{
					openEditor("");
				}
			},
			lineEditorFn:function(prs){
				openEditor(prs.id);
			}	
		};
</script>
</body>
</html>
